package com.qianli.cashmama.product.server.domain;

import com.qianli.cashmama.product.facade.enums.BusinessRuleEnum;
import com.qianli.cashmama.product.facade.enums.NecessaryEnum;
import com.qianli.cashmama.product.facade.enums.RuleOwnerTypeEnum;
import com.qianli.cashmama.product.facade.result.ProductRuleDetail;

/**
 * Created by xuyang on 2017/7/18.
 */
public class BusinessRuleDetailDomain {

    //规则详情中文描述
    private String describe;

    //产品规则名称
    /**
     * @see BusinessRuleEnum code
     */
    private BusinessRuleEnum businessRuleEnum;

    //解析规则用的参数
    private String productRuleValue;

    //是否必须
    /**
     * @see NecessaryEnum
     */
    private NecessaryEnum isNecessary;

    private RuleOwnerTypeEnum ownerType;

    private String ownerCode;

    public ProductRuleDetail newFacade() {
        ProductRuleDetail ruleDetail = new ProductRuleDetail();
        ruleDetail.setDescribe(describe);
        ruleDetail.setProductRule(businessRuleEnum.getCode());
        ruleDetail.setProductRuleValue(productRuleValue);
        ruleDetail.setIsNecessary(isNecessary.getStatus());
        return ruleDetail;
    }

    public String getDescribe() {
        return describe;
    }

    public BusinessRuleDetailDomain setDescribe(String describe) {
        this.describe = describe;
        return this;
    }

    public BusinessRuleEnum getBusinessRuleEnum() {
        return businessRuleEnum;
    }

    public BusinessRuleDetailDomain setBusinessRuleEnum(BusinessRuleEnum businessRuleEnum) {
        this.businessRuleEnum = businessRuleEnum;
        return this;
    }

    public String getProductRuleValue() {
        return productRuleValue;
    }

    public BusinessRuleDetailDomain setProductRuleValue(String productRuleValue) {
        this.productRuleValue = productRuleValue;
        return this;
    }

    public NecessaryEnum getIsNecessary() {
        return isNecessary;
    }

    public BusinessRuleDetailDomain setIsNecessary(NecessaryEnum isNecessary) {
        this.isNecessary = isNecessary;
        return this;
    }

    public RuleOwnerTypeEnum getOwnerType() {
        return ownerType;
    }

    public BusinessRuleDetailDomain setOwnerType(RuleOwnerTypeEnum ownerType) {
        this.ownerType = ownerType;
        return this;
    }

    public String getOwnerCode() {
        return ownerCode;
    }

    public BusinessRuleDetailDomain setOwnerCode(String ownerCode) {
        this.ownerCode = ownerCode;
        return this;
    }
}
